package com.fosu.web.controller;

import com.fosu.Utils.ThreadLocal2JsonObjectUtil;
import com.fosu.common.ResponseResult;
import com.fosu.service.FeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @ClassName FeedbackController
 * @Description TODO
 * @Author 夜天冥
 * @Date 2020/11/14 21:30
 * @Version 1.0
 */
@RestController
@CrossOrigin
@RequestMapping("/feedback")
public class FeedbackController {
    @Autowired
    private FeedbackService feedbackService;

    @GetMapping("/getAllFeedback")
    public ResponseResult getAllFeedback(HttpServletResponse resp){
        return feedbackService.findAllFeedback(resp);
    }

    @RequestMapping(value = "/releaseFeedback",method = RequestMethod.POST)
    public ResponseResult releaseProduct(HttpServletResponse resp) throws Exception {
        return feedbackService.save(resp, ThreadLocal2JsonObjectUtil.getJSONObject());
    }
}
